package ticket

type Common struct {
	CreateTime string `gorm:"column:create_time" json:"createTime"`
	UpdateTime string `gorm:"column:update_time" json:"updateTime"`
}

func NewOrderModel() *OrderModel {
	return &OrderModel{}
}

// OrderModel 售货机商品订单
type OrderModel struct {
	OrderDb
	Common
	PayTime       string `gorm:"column:pay_time" json:"payTime"`
	FinishTime    string `gorm:"column:finish_time" json:"finishTime"`
	EstimatedTime string `gorm:"column:estimated_time" json:"estimatedTime"`
}

type OrderDb struct {
	Id              int    `gorm:"column:id" json:"id"`
	Appid           string `gorm:"column:appid" json:"appid"`
	Openid          string `gorm:"column:openid" json:"openid"`
	MemberId        int    `gorm:"column:member_id" json:"memberId"`
	UserId          int    `gorm:"column:user_id" json:"userId"`
	PlaceId         int    `gorm:"column:place_id" json:"placeId"`
	TicketId        int    `gorm:"column:ticket_id" json:"ticketId"`
	Price           int    `gorm:"column:price" json:"price"`
	DiscountsAmount int    `gorm:"column:discounts_amount" json:"discountsAmount"`
	TotalAmount     int    `gorm:"column:total_amount" json:"totalAmount"`
	PayAmount       int    `gorm:"column:pay_amount" json:"payAmount"`
	DayLen          int    `gorm:"column:day_len" json:"dayLen"`
	TicketNum       int    `gorm:"column:ticket_num" json:"ticketNum"`
	Status          uint8  `gorm:"column:status" json:"status"`
	PayType         uint8  `gorm:"column:pay_type" json:"payType"`
	IsDelete        uint8  `gorm:"column:is_delete" json:"isDelete"`
	ThirdTradeNo    string `gorm:"column:third_trade_no" json:"thirdTradeNo"`
	TradeNo         string `gorm:"column:trade_no" json:"tradeNo"`
	DeviceSn        string `gorm:"column:device_sn" json:"deviceSn"`
	UserName        string `gorm:"column:user_name" json:"userName"`
	PlaceName       string `gorm:"column:place_name" json:"placeName"`
	MemberName      string `gorm:"column:member_name" json:"memberName"`
	MemberPhone     string `gorm:"column:member_phone" json:"memberPhone"`
	TicketInfo      string `gorm:"column:ticket_info" json:"ticketInfo"`
	Message         string `gorm:"column:message" json:"message"`
}

func (m *OrderDb) TableName() string {
	return "ticket_orders"
}
